/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
 */
 
 #include "fosfor_playlist.h"
#include "support.h"

G_DEFINE_TYPE(FosforPlaylist, fosfor_playlist, CLUTTER_TYPE_GROUP);
static GObjectClass *parent_class = NULL;

static void fosfor_playlist_dispose(GObject * object);
static void fosfor_playlist_paint(ClutterActor *actor);
static void fosfor_playlist_allocate(ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags);

static void fosfor_playlist_class_init(FosforPlaylistClass * class)
{
	parent_class = g_type_class_peek_parent(class);
	G_OBJECT_CLASS(class)->dispose = fosfor_playlist_dispose;
	CLUTTER_ACTOR_CLASS(class)->paint = fosfor_playlist_paint;
	CLUTTER_ACTOR_CLASS(class)->allocate = fosfor_playlist_allocate;

	g_signal_new("load-uri", FOSFOR_TYPE_PLAYLIST, 
    								G_SIGNAL_RUN_LAST, 
    								G_STRUCT_OFFSET (FosforPlaylistClass, load_uri), 
    								NULL, NULL,
    								g_cclosure_marshal_VOID__STRING,G_TYPE_NONE,1,G_TYPE_STRING);	

}

static void fosfor_playlist_init(FosforPlaylist * playlist)
{

	clutter_actor_set_reactive(CLUTTER_ACTOR(playlist), TRUE);

}

static void fosfor_playlist_dispose(GObject * object)
{
	G_OBJECT_CLASS(parent_class)->dispose(object);
}

static void fosfor_playlist_paint(ClutterActor *actor)
{
	CLUTTER_ACTOR_CLASS(parent_class)->paint(actor);
}

static void fosfor_playlist_allocate(ClutterActor *actor, const ClutterActorBox *box, ClutterAllocationFlags flags)
{
	FosforPlaylist *playlist = FOSFOR_PLAYLIST(actor);
	playlist->width = box->x2-box->x1;
	playlist->height = box->y2-box->y1;

	CLUTTER_ACTOR_CLASS (parent_class)->allocate(actor,box,flags);	
}

ClutterActor *fosfor_playlist_new()
{
	FosforPlaylist *playlist;

	playlist = g_object_new(FOSFOR_TYPE_PLAYLIST, NULL);
	
	return CLUTTER_ACTOR(playlist);
}
